#ifndef WXSTOOLSPACE_H
#define WXSTOOLSPACE_H

#include <wx/scrolwin.h>

class wxsItemResData;
class wxsTool;


class wxsToolSpace: public wxScrolledWindow {
  public:


    wxsToolSpace( wxWindow* Parent, wxsItemResData* Data );


    virtual ~wxsToolSpace();


    void BeforePreviewChanged();


    void AfterPreviewChanged();


    void RefreshSelection();


    inline bool AreAnyTools() { return m_First != 0; }

  private:

    struct Entry;


    void OnPaint( wxPaintEvent& event );


    void OnMouseClick( wxMouseEvent& event );


    void OnMouseDClick( wxMouseEvent& event );


    void OnMouseRight( wxMouseEvent& event );


    void OnMouse( wxMouseEvent& event );


    void OnKeyDown( wxKeyEvent& event );


    void RecalculateVirtualSize();


    Entry* FindEntry( int& PosX, int& PosY );


    struct Entry {
      wxsTool* m_Tool;
      Entry*   m_Next;
    };

    Entry*          m_First;        ///< \brief First tool in resource
    int             m_Count;        ///< \brief Number of entries
    wxsItemResData* m_Data;         ///< \brief Resource's data
    bool            m_Unstable;
    DECLARE_EVENT_TABLE()
};



#endif
